home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2000 November / macformat-096.iso / MF Data / Behaviours / 00002_Script_fade < prev    next >
Encoding:
Text File  |  2000-09-12  |  1.7 KB  |  48 lines

  1. property startBlend 
  2. property StartFadePoint 
  3. property EndFadePoint
  4.  
  5. on exitFrame me
  6.   sendSprite  (the spritenum of me, #blendit)
  7. end
  8.  
  9. on blendSprite which, what
  10.   set the blend of sprite which = what
  11.   updatestage
  12. end  
  13.  
  14. on blendit me 
  15.   set dv = abs((the locV of sprite the spriteNum of me) - the mousev)
  16.   set  dH = abs((the locH of sprite the spriteNum of me) - the mouseh)
  17.   set distance = sqrt( dV * dV + dH * dH ) 
  18.   if distance < EndFadePoint then
  19.     blendSprite the spriteNum of me,100 
  20.     exit
  21.   end if
  22.   if distance < StartFadePoint then
  23.     set percentage = (distance*100/StartFadePoint) 
  24.     set blendToValue =  (100-percentage)
  25.     if blendToValue < startBlend then set blendToValue =  startBlend 
  26.     blendSprite the spriteNum of me,blendToValue 
  27.   else
  28.     blendSprite the spriteNum of me,startBlend 
  29.   end if
  30.   updatestage
  31. end
  32.  
  33. on getPropertyDescriptionList
  34.   set p_list = [¨
  35.                     #startBlend: [ #default:0, #format:#integer, #comment:"Initial Blend",#range: [#min:0,#Max:100]] ,¨
  36.                        #StartFadePoint: [ #default:100, #format:#integer, #comment:"Trigger Point", #range:[#min:0,#Max:500]],¨
  37.                        #EndFadePoint: [ #default:0, #format:#integer, #comment:"End Trigger Point", #range:[#min:0,#Max:50]] ¨
  38.                     ]
  39.   return p_list
  40. end
  41.  
  42. on getBehaviorDescription
  43.   return  "Creates sprites that fade in and out (using the sprite blend property) depending how far they are from the mouse. " &return&return&¨
  44.                     "Try different inks for your sprites - different images require different settings. Also, there appears to be a bug in Director 6 that prevents sprites with a blend of 0 from being totally hidden. "
  45.   
  46. end
  47.  
  48.